package queue;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @author 乔巴
 * @date 2021/5/19 9:38
 **/
public class TestQueue {
    public static ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue();

    public static void main(String[] args) {
        queue.add("1");
        queue.add("2");
        queue.add("3");
        queue.add("4");
        queue.add("5");
        queue.add("6");
        Iterator iterator = queue.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
            queue.remove(next);
            queue.add(next);
        }
        //得出结论，ConcurrentLinkedQueue是先进先出
        System.out.println(queue.size());
    }
}
